package com.grace.cms.general.controller.manage;

import java.util.List;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.grace.common.core.domain.AjaxResult;
import com.grace.cms.common.constant.OlySystemConstant;
import com.grace.cms.general.controller.CommonController;
import com.grace.cms.general.utils.WebUtils;

/**
 * 站点管理
 * 远程操作本地站点接口
 * 可在配置指定IP访问
 * 管理入口/{themeName}/manage/cache
 */
@RestController
@RequestMapping("/{themeName}" + OlySystemConstant.WEB_MANAGE_URL_PREFIX )
public class CacheController extends CommonController {
    /**
     * 获取本地主题列表
     * 
     * @return
     */
    @GetMapping("/updateCache")
    public AjaxResult updateCache() {
        List<String> themeNames = WebUtils.listThemeNames();
        if (themeNames != null) {
            return success(themeNames);
        }
        return error("本地未安装任何主题!");
    }

}
